
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

import javax.naming.InsufficientResourcesException;
import java.io.IOException;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WGL
 * Date: 2022-10-17
 * Time: 16:27
 */
public class Test {
    public static void main(String[] args) throws IOException {
        String[] names = {"自动化学院","材料与能源学院","机电工程学院","轻工化工学院","信息工程学院","土木与交通工程学院","计算机学院"
        ,"环境科学与工程学院","物理与光电工程学院","生物医药学院","集成电路学院","数学与统计学院","法学院","经济学院","建筑与城市规划学院"
        ,"艺术与设计学院","管理学院"};
        ArrayList<Integer> notRecruited = new ArrayList<>();
        Stack<Integer> stack = new Stack<>();
        Stack<Integer> stack1 = new Stack<>();
        Random random = new Random();
        for (int i = 0; i < 100000; i++) {
            stack1.push((int) (random.nextGaussian() * 1000) + 3000);
        }
        Speciality[] Tar = new Speciality[35];
        Dao dao =new Dao();
        dao.getSpeciallity(Tar);
        dao.getSpecialityFeatrues(Tar);
        System.out.println(" ");

        Student[] toTest = new Student[6000];
        dao.initStudent(toTest,stack,stack1);
        dao.adjustSpecialityFeatures(Tar,names);
        System.out.println(" ");
        dao.sortStudent(toTest);
        dao.sortSpecialityByAvgRank(Tar,0, Tar.length-1);
        dao.getSpecialityRankInTeam(Tar);


        ArrayList<String[]> specialityRecord = dao.getLikeSpecialityReal(Tar);
        dao.getSpecialityToStudent(toTest,Tar,specialityRecord);//Qa
        dao.exportDataToExcel(toTest,Tar);

        ArrayList<EnrollmentTeam> toRecruit = new ArrayList<>();
        dao.getEnrollmentTeam(toRecruit,Tar,names,1);
        dao.sortSpecialityInTeam(toRecruit);

        dao.studentRegisterToTeam(toTest,toRecruit);//Q,T
        dao.abortTeam(toTest);//P
//        dao.getEnrollmentTeamsV(toRecruit);
        dao.judgeStudentAdjustment(toTest);
        dao.studentGetSpecialityInTeam(toTest);
        dao.officiallyRecruitStudent(toTest);
        dao.recruitSecondRound(toTest);
        dao.countRankNotRecruit(notRecruited,toTest);

        ShowInf showInf = new ShowInf();
        InfCollector[] infCollectors = new InfCollector[Tar.length];
        for (int i = 0; i < Tar.length; i++) {
            infCollectors[i] = new InfCollector();
            infCollectors[i].name = Tar[i].name;
        }
        showInf.showSpecialityStudentInf(Tar,infCollectors,toTest,toRecruit);
//        for (int i = 0; i < 100; i++) {
//            System.out.println(" ");
//        }
//        showInf.showSpecialityInTUmu(Tar,infCollectors);
//        showInf.showAcademyLos(infCollectors,Tar,names);
//        showInf.showChuangxing(infCollectors,Tar);
        System.out.println(" ");
        System.out.println("=======================================================================================================================");
    }
}
